package com.net.j8583;

import com.net.j8583.field.*;

import java.util.LinkedHashMap;

/**
 * Created with IntelliJ IDEA.
 *
 * Date: 11/16/13
 * Time: 11:06 AM
 */
public class Define8583Bank implements Define8583 {
    @Override
    public LinkedHashMap<Integer, Field> getDefineFieldBody() {
        LinkedHashMap<Integer, Field> fieldMap = new LinkedHashMap<Integer, Field>();
        fieldMap.put(2, new FieldVarBcd2(19));
        fieldMap.put(3, new FieldBcd(6));
        fieldMap.put(4, new FieldBcd(12));
        fieldMap.put(8, new FieldAsc(11));
        fieldMap.put(11, new FieldBcd(6));
        fieldMap.put(12, new FieldAsc(6));
        fieldMap.put(14, new FieldBcd(4));
        fieldMap.put(22, new FieldBcd(3));
        fieldMap.put(24, new FieldBcd(3));
        fieldMap.put(25, new FieldBcd(1));
        fieldMap.put(32, new FieldVarBcd2(4));
        fieldMap.put(41, new FieldAsc(8));
        fieldMap.put(42, new FieldAsc(15));
        fieldMap.put(44, new FieldVar2(99));
        fieldMap.put(49, new FieldBcd(3));

        Field f621 = new FieldAsc(4);
        Field f622 = new FieldAsc(6);
        Field f623 = new FieldAsc(14);
        Field f624 = new FieldVar3(999);
        FieldComp fieldComp = new FieldComp(4,f621,f622,f623,f624);
        fieldMap.put(62, fieldComp);
        fieldMap.put(64, new FieldMac(2, 3, 4, 11, 49, 41));
        return fieldMap;
    }

    @Override
    public LinkedHashMap<Integer, Field> getDefineFieldHeader() {
        LinkedHashMap<Integer, Field> fieldMap = new LinkedHashMap<Integer, Field>();
        fieldMap.put(-3, new FieldBcd(10));
        fieldMap.put(-2, new FieldBcd(4));
        fieldMap.put(-1, new FieldBcd(4));
        fieldMap.put(1, new FieldBitMap());
        return fieldMap;
    }
}
